package com.cgtong.android.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.cgtong.android.R;
import com.cgtong.android.bean.RecordBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class RecordAdapter extends BaseQuickAdapter<RecordBean, BaseViewHolder> {


    public RecordAdapter(@Nullable List<RecordBean> data) {
        super(R.layout.adapter_my_record, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, RecordBean item) {

        helper.setText(R.id.date_txt, item.getCreateAt());
        helper.setText(R.id.content_txt, item.getTypeName());
        helper.setText(R.id.score_txt, "+" + item.getScore());
        if (item != null) {
            if (item.getTypeName().contains("注册")) {
                ((TextView) helper.getConvertView().findViewById(R.id.score_txt)).setTextColor(Color.parseColor("#54BB50"));
            } else if (item.getTypeName().contains("上报")) {
                ((TextView) helper.getConvertView().findViewById(R.id.score_txt)).setTextColor(Color.parseColor("#FF6100"));
            } else if (item.getTypeName().contains("评价")) {
                ((TextView) helper.getConvertView().findViewById(R.id.score_txt)).setTextColor(Color.parseColor("#2A43F5"));
            }
        }
    }
}
